//封装鼠标放上显示函数
function dianji(daohang,daohang1,open){
daohang.onmouseover=function(){
	daohang1.style.display="block";
	daohang.style.background="white";
	daohang.style.border="1px solid #ddd";
	daohang.style.borderBottom="none";
	open.style.transform="rotateZ(180deg)";
}
}
//封装鼠标离开消失函数
function xiaoshi(daohang,daohang1,open){
daohang.onmouseout=function(){
	daohang1.style.display="none";
	daohang.style.cssText={
		'background':'#F5F5F5',
		'border':'1px solid #f5f5f5',
		'borderBottom':'none'
	}
	open.style.transform="rotateZ(0deg)";
}
}

//网站导航特效
var navi=document.getElementById("navi");
var daohang=navi.children[0];
var daohang1=document.getElementById("daohang1");
var oOpen = document.getElementById("open");
dianji(daohang,daohang1,oOpen);
xiaoshi(daohang,daohang1,oOpen);
//商家入驻特效
var ruzhu=navi.children[1];
var ruzhu1=document.getElementById("ruzhu1");
var oOpen1 = document.getElementById("open1")
dianji(ruzhu,ruzhu1,oOpen1);
xiaoshi(ruzhu,ruzhu1,oOpen1);
//我的订单特效
var navi1=document.getElementById("navi1");
var dingdan=navi1.children[1];
var dingdan1=document.getElementById("dingdan1");
dianji(dingdan,dingdan1);
xiaoshi(dingdan,dingdan1);
//我的易购特效
var yigou=navi1.children[2];
var yigou1=document.getElementById("yigou1");
dianji(yigou,yigou1)
xiaoshi(yigou,yigou1);

//手机苏宁特效
var sj=navi1.children[4];
var sj1=document.getElementById("sj1");
dianji(sj,sj1)
xiaoshi(sj,sj1)
var kefu=navi1.children[7];
var kefu1=document.getElementById("kefu1");
dianji(kefu,kefu1);
xiaoshi(kefu,kefu1);










////焦点图代码
//var oaa=document.getElementById("aa");
//var oli = oaa.children;
//var arrow = document.getElementById("arrow");
//var oarrow = document.getElementById("arrow").children;
//var banner1 = document.getElementById("banner1");
//var photo = document.getElementById("photo");
//var Span = document.getElementById("num")
//var oSpan = document.getElementById("num").children;
//
//photo.style.width = oli[1].offsetWidth*(oli.length-2)+"px";
//var animated = false;
//var index = 1;
//function showButton(){
//	for(var i=0;i<oSpan.length;i++){
//		if(oSpan[i].style.backgroundColor == "red"){
//			oSpan[i].style.backgroundColor = "#333";
//			break;
//		}
//	}
//	oSpan[index-1].style.backgroundColor = "red";
//}
//function animate(offset){
//	animated = true;
//	var newLeft = parseInt(photo.style.left)+offset;
//	var time = 300;//位移总时间；
//	var interval = 10;//唯一间隔时间；
//	var speed = offset/(time/interval);//每次位移量；
//	
//	function go(){
//		animated = false;
//		if( (speed<0&&parseInt(photo.style.left)>newLeft)||(speed>0&&parseInt(photo.style.left)<newLeft) ){
//			photo.style.left = parseInt(photo.style.left)+speed+"px";
//			setTimeout(go,interval)
//		}else{
//			photo.style.left = newLeft + "px";
//			if(newLeft>-oli[1].offsetWidth){
//			photo.style.left=-photo.style.width;
//			}
//			if(newLeft<-photo.style.width){
//			photo.style.left = -oli[1].offsetWidth+"px";
//			}
//		}
//	}
//	go();
//}
////点击右箭头切换图片
//var change = null;
//change = oarrow[1].onclick=function(){
//	if(index == 6){
//		index = 1;
//	}else{
//		index += 1;
//	}
//	showButton();
//	if(!animated){
//		animate(-1366);
//	}
//}
////定时器
//set = setInterval(change,3000);
//Span.onmouseover = arrow.onmouseover = photo.onmouseover = function(){
//	clearInterval(set);
//}
//Span.onmouseout = arrow.onmouseout = photo.onmouseout = function(){
//	set = setInterval(change,3000);
//}
////点击左箭头切换图片；
//oarrow[0].onclick=function(){
//	if(index==1){
//		index=6;
//	}else{
//		index -=1;
//	}
//	showButton();
//	if(!animated){
//		animate(1366);
//	}
//}
//for(var i=0;i<oSpan.length;i++){
//	oSpan[i].onclick = function(){
//		if(this.style.backgroundColor=="red"){
//			return;
//		}
//		var myIndex = parseInt(this.getAttribute('index'));
//		var offset =-1366*(myIndex-index);
//		index = myIndex;
//		showButton();
//		if(!animated){
//		animate(offset);
//		}
//	}
//}






//菜单特效；
var oMenu = document.getElementById("menu");
var oLi = oMenu.children;
var oDiv = oLi[1].children[0];
for(var i = 0;i < oLi.length;i++){
	oLi[i].onmouseover=function(){
		this.children[1].style.display="block";
	}
	oLi[i].onmouseout=function(){
		this.children[1].style.display="none";
	}
}









//点击箭头图片进行滚动
var ogo = document.getElementById("go");
var photo1 = document.getElementById("photo1");
var omap =  document.getElementById("map").children;
function animater(offseted){
	var newLeft = parseInt(photo1.style.left)+offseted;
	var time1 = 300;//位移总时间；
	var interval1 = 10;//唯一间隔时间；
	var speed = offseted/(time1/interval1);//每次位移量；
	//设置递归函数
	function goes(){
		if( (speed<0&&parseInt(photo1.style.left)>newLeft)||(speed>0&&parseInt(photo1.style.left)<newLeft) ){
			photo1.style.left = parseInt(photo1.style.left)+speed+"px";
			//调用自身
			setTimeout(goes,interval1)
		}else{
			photo1.style.left = newLeft + "px";
			if(newLeft>-1200){
			photo1.style.left=-3600+"px";
			}
			if(newLeft<-3600){
			photo1.style.left = -1200+"px";
			}
		}
	}
	goes();
}
//点击右箭头切换图片

omap[1].onclick=function(){
		animater(-1200);	
}
omap[0].onclick=function(){
		animater(1200);	
}
//鼠标放上去箭头消失；
ogo.onmouseover=function(){
	document.getElementById("map").style.display="block";
}
ogo.onmouseout=function(){
	document.getElementById("map").style.display="none";
}






////执行往返动画
var oMover = document.getElementById("mover");
var oBigju = document.getElementById("bigju");
var oChaoshi = document.getElementById("chaoshi");
oBigju.onmouseover = function(){
    				move1(-1,-10,oBigju);
    			}
oBigju.onmouseout = function(){
    				move1(1,0,oBigju);
    			}
oChaoshi.onmouseover = function(){
    				move2(-1,-10,oChaoshi);
    			}
oChaoshi.onmouseout = function(){
    				move2(1,0,oChaoshi);
    			}
var time1 = null;
var time2 = null;
var time3 = null;
var time4 = null;
var time5 = null;
var time6 = null;
function move1(x,y,z){
	clearInterval(time1);
	time1 = setInterval(
		function(){
			if(z.offsetLeft==y){
				clearInterval(time1);
			}else{
				z.style.left = z.offsetLeft+x+"px";
			}
		},30)
}
//第六个动画
function move6(x,y,z){
	clearInterval(time6);
	time6= setInterval(
		function(){
			if(z.offsetLeft==y){
				clearInterval(time6);
			}else{
				z.style.left = z.offsetLeft+x+"px";
			}
		},30)
}
//第五个动画
function move5(x,y,z){
	clearInterval(time5);
	time5 = setInterval(
		function(){
			if(z.offsetLeft==y){
				clearInterval(time5);
			}else{
				z.style.left = z.offsetLeft+x+"px";
			}
		},30)
}
//第四个动画
function move4(x,y,z){
	clearInterval(time4);
	time4 = setInterval(
		function(){
			if(z.offsetLeft==y){
				clearInterval(time4);
			}else{
				z.style.left = z.offsetLeft+x+"px";
			}
		},30)
}
//第三个动画
function move3(x,y,z){
	clearInterval(time3);
	time3 = setInterval(
		function(){
			if(z.offsetLeft==y){
				clearInterval(time3);
			}else{
				z.style.left = z.offsetLeft+x+"px";
			}
		},30)
}
//第二个动画
function move2(x,y,z){
	clearInterval(time2);
	time2 = setInterval(
		function(){
			if(z.offsetLeft==y){
				clearInterval(time2);
			}else{
				z.style.left = z.offsetLeft+x+"px";
			}
		},30)
}
var oApple = document.getElementById("apple");
var oImg = oApple.getElementsByTagName("img")[0];

oApple.onmouseover = function(){
    				move5(-1,70,oImg);
    				this.style.border="2px solid red";
    			}
oApple.onmouseout = function(){
    				move5(1,80,oImg);
    				this.style.border="2px solid #fff";
    			}
var oApple1 = document.getElementById("apple1");
var oImg1 = oApple1.getElementsByTagName("img")[0];

oApple1.onmouseover = function(){
    				move2(-1,70,oImg1);
    				this.style.border="2px solid red";
    			}
oApple1.onmouseout = function(){
    				move2(1,80,oImg1);
    				this.style.border="2px solid #fff";
    			}
//第三张
var oApple2 = document.getElementById("apple2");
var oImg2 = oApple2.getElementsByTagName("img")[0];

oApple2.onmouseover = function(){
    				move3(-1,70,oImg2);
    				this.style.border="2px solid red";
    			}
oApple2.onmouseout = function(){
    				move3(1,80,oImg2);
    				this.style.border="2px solid #fff";
    			}
//第四张
var oApple3 = document.getElementById("apple3");
var oImg3 = oApple3.getElementsByTagName("img")[0];

oApple3.onmouseover = function(){
    				move1(-1,70,oImg3);
    				this.style.border="2px solid red";
    			}
oApple3.onmouseout = function(){
    				move1(1,80,oImg3);
    				this.style.border="2px solid #fff";
    			}
//第五张
var oApple4 = document.getElementById("apple4");
var oImg4 = oApple4.getElementsByTagName("img")[0];

oApple4.onmouseover = function(){
    				move6(-1,70,oImg4);
    				this.style.border="2px solid red";
    			}
oApple4.onmouseout = function(){
    				move6(1,80,oImg4);
    				this.style.border="2px solid #fff";
    			}
//第六张
var oApple5 = document.getElementById("apple5");
var oImg5 = oApple5.getElementsByTagName("img")[0];

oApple5.onmouseover = function(){
    				move3(-1,70,oImg5);
    				this.style.border="2px solid red";
    			}
oApple5.onmouseout = function(){
    				move3(1,80,oImg5);
    				this.style.border="2px solid #fff";
    			}
//第七张
var oApple6 = document.getElementById("apple6");
var oImg6 = oApple6.getElementsByTagName("img")[0];

oApple6.onmouseover = function(){
    				move5(-1,70,oImg6);
    				this.style.border="2px solid red";
    			}
oApple6.onmouseout = function(){
    				move5(1,80,oImg6);
    				this.style.border="2px solid #fff";
    			}
//第八张
var oApple7 = document.getElementById("apple7");
var oImg7 = oApple7.getElementsByTagName("img")[0];

oApple7.onmouseover = function(){
    				move4(-1,70,oImg7);
    				this.style.border="2px solid red";
    			}
oApple7.onmouseout = function(){
    				move4(1,80,oImg7);
    				this.style.border="2px solid #fff";
}




//随滚动条滚动搜索框
var oSearch = document.getElementById("search");
window.onscroll = function(){
	if(document.body.scrollTop>=812){
	oSearch.style.display="block";
	}else if(document.body.scrollTop<812){
	oSearch.style.display="none";
	}
}



//大牌盛宴
var oHua = document.getElementById("hua").children;
var oIm = oHua[0].getElementsByTagName("img")[0];
var oIm1 = oHua[1].getElementsByTagName("img")[0];
var oIm2 = oHua[2].getElementsByTagName("img")[0];
var oIm3 = oHua[3].getElementsByTagName("img")[0];
oHua[0].onmouseover = function(){
    				move2(-1,80,oIm);
    			}
oHua[0].onmouseout = function(){
    				move2(1,90,oIm);
}
oHua[1].onmouseover = function(){
    				move3(-1,80,oIm1);
    			}
oHua[1].onmouseout = function(){
    				move3(1,90,oIm1);
}
oHua[2].onmouseover = function(){
    				move4(-1,80,oIm2);
    			}
oHua[2].onmouseout = function(){
    				move4(1,90,oIm2);
}

oHua[3].onmouseover = function(){
    				move5(-1,80,oIm3);
    			}
oHua[3].onmouseout = function(){
    				move5(1,90,oIm3);
}
function aa(){
	oHua[1].style.borderRight=oHua[3].style.borderRight="none";
	oHua[2].style.borderBottom=oHua[3].style.borderBottom="none";
}
aa();


//精选好货
var oHaier = document.getElementById("haier").children;
var oIm10 = oHaier[0].getElementsByTagName("img")[0];
var oIm11 = oHaier[1].getElementsByTagName("img")[0];
var oIm21 = oHaier[2].getElementsByTagName("img")[0];
var oIm31 = oHaier[3].getElementsByTagName("img")[0];
var oIm41 = oHaier[4].getElementsByTagName("img")[0];
var oIm51 = oHaier[5].getElementsByTagName("img")[0];
oHaier[0].onmouseover = function(){
    				move1(-1,80,oIm10);
    			}
oHaier[0].onmouseout = function(){
    				move1(1,90,oIm10);
}
oHaier[1].onmouseover = function(){
    				move2(-1,80,oIm11);
    			}
oHaier[1].onmouseout = function(){
    				move2(1,90,oIm11);
}
oHaier[2].onmouseover = function(){
    				move6(-1,80,oIm21);
    			}
oHaier[2].onmouseout = function(){
    				move6(1,90,oIm21);
}

oHaier[3].onmouseover = function(){
    				move5(-1,80,oIm31);
    			}
oHaier[3].onmouseout = function(){
    				move5(1,90,oIm31);
}
oHaier[4].onmouseover = function(){
    				move4(-1,80,oIm41);
    			}
oHaier[4].onmouseout = function(){
    				move4(1,90,oIm41);
}
oHaier[5].onmouseover = function(){
    				move3(-1,80,oIm51);
    			}
oHaier[5].onmouseout = function(){
    				move3(1,90,oIm51);
}
function bb(){
	oHaier[3].style.borderRight=oHaier[5].style.borderRight=oHaier[1].style.borderRight="none";
	oHaier[5].style.borderBottom=oHaier[4].style.borderBottom="none";
}
bb();





//更多清单
var oSport = document.getElementById("sport");
var aLi = oSport.getElementsByTagName("li");
aLi[0].onmouseover = function(){
		move1(-1,20,aLi[0].getElementsByTagName("img")[0]);
}
aLi[0].onmouseout = function(){
		move1(1,30,aLi[0].getElementsByTagName("img")[0]);
}
aLi[1].onmouseover = function(){
		move2(-1,20,this.getElementsByTagName("img")[0]);
}
aLi[1].onmouseout = function(){
		move2(1,30,this.getElementsByTagName("img")[0]);
}
aLi[2].onmouseover = function(){
		move3(-1,20,this.getElementsByTagName("img")[0]);
}
aLi[2].onmouseout = function(){
		move3(1,30,this.getElementsByTagName("img")[0]);
}


var oSport1 = document.getElementById("sport1");
var aLi1 = oSport1.getElementsByTagName("li");
aLi1[0].onmouseover = function(){
		move4(-1,20,this.getElementsByTagName("img")[0]);
}
aLi1[0].onmouseout = function(){
		move4(1,30,this.getElementsByTagName("img")[0]);
}
aLi1[1].onmouseover = function(){
		move5(-1,20,this.getElementsByTagName("img")[0]);
}
aLi1[1].onmouseout = function(){
		move5(1,30,this.getElementsByTagName("img")[0]);
}
aLi1[2].onmouseover = function(){
		move6(-1,20,this.getElementsByTagName("img")[0]);
}
aLi1[2].onmouseout = function(){
		move6(1,30,this.getElementsByTagName("img")[0]);
}



//拉动滚动条显示服装百货侧边栏；
var oFloor = document.getElementById("floor");
window.addEventListener('scroll',function(){
	if(document.body.scrollTop>=1600){
	oFloor.style.display="block";
	}else{
	oFloor.style.display="none";
	}
},false)



//弹出层特效
//	//获取页面的宽度和高度
//		var sHeight=document.documentElement.scrollHeight;
//		var sWidth=document.documentElement.scrollWidth;
//		//可视区域的宽和高
//			kHeight = document.documentElement.clientHeight;	
//		//创建一个div 
//		var oMask = document.createElement("div");
//			oMask.id= "mask";
//    		oMask.style.width=sWidth+"px";
//    		oMask.style.height=sHeight+"px";
//    		document.body.appendChild(oMask);
//    	var oPopup = document.createElement("div");
//    		oPopup.id = "popup";
//    	//在div中添加内容
//    		oPopup.innerHTML = "<img src='image/alert.png' /><div id='faded'>x</div>"
//    		document.body.appendChild(oPopup);
//    	//popup的宽度和高的度
//    		var dWidth = oPopup.offsetWidth;
//    		var dHeight = oPopup.offsetHeight;
//    		oPopup.style.left = (sWidth-dWidth)/2+"px";
//    		oPopup.style.top = (kHeight-dHeight)/2+"px";
//    	//点击遮罩层或关闭按钮弹出层消失
//    		oMask.onclick=faded.onclick = function(){
//    		document.body.removeChild(oMask);
//    		document.body.removeChild(oPopup);
//    	}